import request from '@/commons/libraries/request'
export default {
  async gets (page, pageSize) {
    try {
      const ret = await request('/member/recomcode/gets/', {
        page: page,
        pageSize: pageSize
      })
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async getCount () {
    try {
      const ret = await request('/member/recomcode/getCount/', {})
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async add (data) {
    try {
      const ret = await request('/member/recomcode/add/', data)
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  },
  async get (id) {
    try {
      const ret = await request('/member/recomcode/get/', { wid: id })
      return ret
    } catch (err) {
      return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
    }
  }
  // async edit (data) {
  //   try {
  //     const ret = await request('/member/list/edit/', data)
  //     return ret
  //   } catch (err) {
  //     return Promise.reject(new Error(`系统错误，请稍后再试！<br/>[${err.message}]`))
  //   }
  // },
}
